package com.hronline;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

@SuppressWarnings("deprecation")
public class TabbarActivity extends TabActivity {//extends ActivityGroup implements OnTabChangeListener {
	
//	public TabHost tabhost;
//
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.activity_tabbar);
//		
//		tabhost = (TabHost) findViewById(R.id.tabhost);
//        LocalActivityManager localActivityManager = new LocalActivityManager(this, false);
//        localActivityManager.dispatchCreate(savedInstanceState);
//        tabhost.setup(localActivityManager);  
//        tabhost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);
//        tabhost.setOnTabChangedListener(this);
//        
//        
//        TabSpec homeTab = tabhost.newTabSpec(getString(R.string.tabbar_home));
//        homeTab.setIndicator(createTabView(this, getString(R.string.tabbar_home), getResources().getDrawable(R.drawable.tabbar_home)));
//        homeTab.setContent(new Intent().setClass(this, ManagerDashboardStackActivity.class));
//        
//        TabSpec contactTab = tabhost.newTabSpec(getString(R.string.tabbar_contacts));
//        contactTab.setIndicator(createTabView(this, getString(R.string.tabbar_contacts), getResources().getDrawable(R.drawable.tabbar_planner)));
//        contactTab.setContent(new Intent().setClass(this, ManagerContactStackActitvity.class));
//        
//        TabSpec employeesTab = tabhost.newTabSpec(getString(R.string.tabbar_employees));
//        employeesTab.setIndicator(createTabView(this, getString(R.string.tabbar_employees), getResources().getDrawable(R.drawable.tabbar_employees)));
//        employeesTab.setContent(new Intent().setClass(this, ManagerEmployeesStackActivity.class));
//        
//        TabSpec taskTab = tabhost.newTabSpec(getString(R.string.tabbar_task));
//        taskTab.setIndicator(createTabView(this, getString(R.string.tabbar_task), getResources().getDrawable(R.drawable.tabbar_tasks)));
//        taskTab.setContent(new Intent().setClass(this, ManagerTaskStackActitvity.class));
//        
//        TabSpec moreTab = tabhost.newTabSpec(getString(R.string.tabbar_more));
//        moreTab.setIndicator(createTabView(this, getString(R.string.tabbar_more), getResources().getDrawable(R.drawable.more)));
//        moreTab.setContent(new Intent().setClass(this, ManagerMoreStackActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
//        
//        // add tabs to TabHost
//        tabhost.addTab(homeTab);
//        tabhost.addTab(contactTab);
//        tabhost.addTab(employeesTab);
//        tabhost.addTab(taskTab);
//        tabhost.addTab(moreTab);
//	}
//
//	private static View createTabView(Context context, String text, Drawable icon) {
//		View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
//		TextView tv = (TextView) view.findViewById(R.id.tabsText);
//		tv.setText(text);
//		ImageView imageView = (ImageView) view.findViewById(R.id.tabsIcon);
//		imageView.setBackgroundDrawable(icon);
//		return view;
//	}
//    
//    public void switchTab(int tab){
//        tabhost.setCurrentTab(tab);
//    }
//
//    /**implement OnTabChangeListener**/
//	public void onTabChanged(String tabId) {
//		setTitle(tabId);
//	}
	
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tabbar);

        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;
        Intent intent;

        intent = new Intent().setClass(this, ManagerDashboardStackActivity.class);
        spec = tabHost.newTabSpec("dashboard").setIndicator(getString(R.string.tabbar_home), getResources().getDrawable(R.drawable.tabbar_home)).setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, ManagerContactStackActitvity.class);
        spec = tabHost.newTabSpec("contact").setIndicator(getString(R.string.tabbar_contacts), getResources().getDrawable(R.drawable.tabbar_planner)).setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, ManagerEmployeesStackActivity.class);
        spec = tabHost.newTabSpec("employees").setIndicator(getString(R.string.tabbar_employees), getResources().getDrawable(R.drawable.tabbar_employees)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, ManagerTaskStackActitvity.class);
        spec = tabHost.newTabSpec("task").setIndicator(getString(R.string.tabbar_task), getResources().getDrawable(R.drawable.tabbar_tasks)).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, ManagerMoreStackActivity.class);
        spec = tabHost.newTabSpec("more").setIndicator(getString(R.string.tabbar_more), getResources().getDrawable(R.drawable.more)).setContent(intent);
        tabHost.addTab(spec);

        // set default tab
        tabHost.setCurrentTabByTag("dashboard");
    }

}
